package com.xinchao.service.impl;

import com.xinchao.dao.UserMapper;
import com.xinchao.model.User;
import com.xinchao.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 用户Service实现类
 *
 * @author dxy
 * @date 2018/6/21 15:27
 */
@Service(value = "userService")
public class UserServiceImpl implements UserService {
	@Autowired
	private UserMapper userMapper;

	/**
	 * 通过用户名获取用户
	 *
	 * @param userName 用户名
	 * @return User(用户)
	 */
	@Override
	@Transactional(readOnly = true, rollbackFor = Exception.class)
//    @Cacheable(value = "user", key = "'userName:'+#userName")
	public User getUserByUserName(String userName) {
		return userMapper.getUserByUserName(userName);
	}

}
